from core.basehandler import BaseHandler
from core.room import Room
from core.action import Action
from core.support import set_cutscene

class Home(Room):
    
    def __init__(self, room_id):
        Room.__init__(self, room_id)    # do basic initialization for every room
        
        # build list of actions
        self.add_action(Email)
        self.add_action(Coffee)
        self.add_action(Facebook)
    
    # return description of room.
    def get_description(self):
        return '''
        A long time ago, in a PC far, far away...
        While coding a new adventure game for your IS class you receive an email from an 
        unknown sender, but also notice your hoity toity vanilla chai non-fat latte ready for a sip.
        '''
    # return image of room
    def get_image(self):
        return 'home.png'
    

class HomeHandler(BaseHandler):
    
    # return class to use to create a new instance of this room
    def get_room_class(self):
        return Home

    def get_template(self):
        return 'home.html'

# define actions for this room

class Email(Action):
    def __init__(self):
        Action.__init__(self, "Email")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Read email"
    
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'cpu'
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "get"

class Coffee(Action):
    def __init__(self):
        Action.__init__(self, "Coffee")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Drink coffee"
    
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'home'
    
    def do_action(self,game,room,request):
        set_cutscene('''
        Ahhh...Refreshing! Now that you've sipped that sweet, sweet coffee,
        you can now divert your attention to this mysterious email... or take another sip of coffee.''')
        return
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def post_method(self):
        return "post"

class Facebook(Action):
    def __init__(self):
        Action.__init__(self, "Facebook")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Check Facebook"
    
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'home'
    
    def do_action(self,game,room,request):
        set_cutscene('''
        You find out that your second cousin on your mother's side is eating a Subway sandwich for lunch,
        but other than that there is nothing interesting going on.''')
        return
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def post_method(self):
        return "post"